<?php
/* [$WindsForce] (C)Hunzhiwange.COM Since 2012.03.17.
   查看百科($$)*/

!defined('Q_PATH') && exit;

class Show_C_Controller extends InitController{

	public function index(){
		$nId=intval(Q::G('id','G'));
		if(empty($nId)){
			$this->page404();
		}

		$arrGrouptopic=Model::F_('grouptopic','@A','A.grouptopic_id=? AND A.grouptopic_status=1 AND A.group_id=313',$nId)
			->setColumns('A.grouptopic_id,A.grouptopic_title,A.create_dateline,A.grouptopic_views,A.grouptopic_comments,A.grouptopiccategory_id')
			->joinLeft(Q::C('DB_PREFIX').'grouptopiccategory AS C','C.grouptopiccategory_name','A.grouptopiccategory_id=C.grouptopiccategory_id')
			->join(Q::C('DB_PREFIX').'grouptopiccontent AS E','E.grouptopic_content','A.grouptopic_id=E.grouptopic_id')
			->getOne();

		if(empty($arrGrouptopic['grouptopic_id'])){
			$this->page404();
		}

		// 更新点击量
		Model::M_('grouptopic')->updateWhere(array('grouptopic_views'=>$arrGrouptopic['grouptopic_views']+1),'grouptopic_id=?',$nId);
		$arrGrouptopic['grouptopic_views']++;

		Core_Extend::getSeo($this,array(
			'title'=>$arrGrouptopic['grouptopic_title'].'_装修百科',
			'keywords'=>$arrGrouptopic['grouptopic_title'].'装修百科'),true,false);
		
		$this->assign('arrGrouptopic',$arrGrouptopic);
		$this->display('baike+show');
	}

}
